#coding=utf8
import sys
sys.path.append('..')
reload(sys)
sys.setdefaultencoding('utf8')
from worldcup.func import get_client
from worldcup.message_lib import menu_text
from wechatpy import WeChatClient

'''
    some func about weixin menu
'''

def get_menu():
    client = get_client()
    menu = client.menu.get()
    print menu

def create_menu():
    client = get_client()
    result = client.menu.create({
        "button":[
            {
                "name":menu_text['my_info'],
                "sub_button":[
                    {
                        "type":"view",
                        "name":menu_text['my_info'],
                        "url":"http://worldcup.dmpb.com.cn/"
                    },
                    {
                        "type":"view",
                        "name":menu_text['my_travel'],
                        "url":"http://worldcup.dmpb.com.cn/"
                    },
                ]
            },
            {
                "name":menu_text['my_group'],
                "type":"view",
                "url":"http://worldcup.dmpb.com.cn/"
            },
            {
                "name":menu_text['help'],
                "sub_button":[
                    {
                        "type":"view",
                        "name":menu_text['help_induction'],
                        "url":"http://worldcup.dmpb.com.cn/"
                    },
                    {
                        "type":"click",
                        "name":menu_text['help_contact'],
                        "key":"MENU_HELP_CONTACT"
                    },
                    {
                        "type":"click",
                        "name":menu_text['help_statement'],
                        "key":"MENU_HELP_STATEMENT"
                    }
                ]
            }
        ]
    })
    print result

if __name__ == "__main__":
    #get_menu()
    create_menu()
